package com.hudson.plugin;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Views entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "views", catalog = "reportdb")
public class Views implements java.io.Serializable {

    // Fields

    private Integer id;
    private Hudsons hudsons;
    private String icafeProject;
    private String module;
    private String version;
    private String viewName;
    private String url;
    private Set<Projects> projectses = new HashSet<Projects>(0);

    // Constructors

    /**
     * default constructor
     */
    public Views() {
    }

    /**
     * full constructor
     */
    public Views(Hudsons hudsons, String icafeProject, String module,
                 String version, String viewName, String url,
                 Set<Projects> projectses) {
        this.hudsons = hudsons;
        this.icafeProject = icafeProject;
        this.module = module;
        this.version = version;
        this.viewName = viewName;
        this.url = url;
        this.projectses = projectses;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "hudson_id")
    public Hudsons getHudsons() {
        return this.hudsons;
    }

    public void setHudsons(Hudsons hudsons) {
        this.hudsons = hudsons;
    }

    @Column(name = "icafe_project", length = 256)
    public String getIcafeProject() {
        return this.icafeProject;
    }

    public void setIcafeProject(String icafeProject) {
        this.icafeProject = icafeProject;
    }

    @Column(name = "module", length = 64)
    public String getModule() {
        return this.module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    @Column(name = "version", length = 32)
    public String getVersion() {
        return this.version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Column(name = "view_name", length = 64)
    public String getViewName() {
        return this.viewName;
    }

    public void setViewName(String viewName) {
        this.viewName = viewName;
    }

    @Column(name = "url", length = 256)
    public String getUrl() {
        return this.url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "views")
    public Set<Projects> getProjectses() {
        return this.projectses;
    }

    public void setProjectses(Set<Projects> projectses) {
        this.projectses = projectses;
    }

}